fileID = fopen('log_creatMDF.txt','a');
fprintf(fileID,'%s\n',datestr(now));
%% 获取时间戳
DataNum = size(timer,1);
my_datetime_raw = datetime(timer,'InputFormat','yyyy-MM-dd HH:mm:ss');
for i =1:DataNum-1
    my_datetime_err(i,1) = my_datetime_raw(i+1)-my_datetime_raw(i);
end
my_datetime_err(DataNum) = my_datetime_err(DataNum-1);
my_datetime = my_datetime_err;
my_datetime(1,1)=0;
for i =2:DataNum
    my_datetime(i,1) = my_datetime(i-1,1) + my_datetime_err(i,1);
end

%%

dt = datestr(now,'yyyy_mmmm_dd_HH_MM_SS');
dt = string(dt);

excelFileName = strsplit(file,'.');
excelFileName = excelFileName(1);
FilenameMDF = strcat(excelFileName,'__',dt,'.MF4');


for i=2:TotalSignalNum
    excelTable_NameEN_index = string(signallist.SignalName_EN(i));

    fprintf(fileID,'write MDF File:%d,%s\n',int32(i),excelTable_NameEN_index);
    fprintf('write MDF File:%d,%s\n',int32(i),excelTable_NameEN_index);
    tempstr1 = strcat('MDF_SignalName = timetable(',excelTable_NameEN_index,",'RowTimes',my_datetime);"');
    eval(tempstr1); %creat timetable
    % MDF_SignalName = timetable(timer,excelTable_NameEN_index)




    string5 = strcat("mdfWrite('",FilenameMDF,"',MDF_SignalName,GroupNumber=",string(i),");");
    eval(string5)
end
fprintf(fileID,'write done----------------------------------\n')
fprintf('write done----------------------------------\n')
fclose(fileID);